package com.rd.student.jiaji.class3.caiyuxin.Java8_1;

import java.util.Arrays;

public class Gudugudu {
    public static void main(String[] args) {
        int[] arr={66,77,33,55,11,22,80};
        gudu(arr);
    }
    public static void gudu(int[] arr){

        for (int j=0;j<arr.length;j++) {
            boolean right=false;

            for (int i = 0; i <arr.length-1-j; i++) {
                if (arr[i]>arr[i+1]){
                    int a=arr[i];
                    arr[i]=arr[i+1];
                    arr[i+1]=a;
                    System.out.print("diaohuan");
                    right=true;
                }



            }
            if (right==false){
                System.out.println("提前结束");
                System.out.println(Arrays.toString(arr));
                return;
            }
            System.out.println("++");
        }
        System.out.println(Arrays.toString(arr));
    }
}
